package com.docker.manege.image;

import com.alibaba.fastjson.JSONObject;
import com.docker.core.mvc.Remark;
import com.jfinal.aop.Aop;
import com.docker.core.third.websocket.BaseWebsocketController;
import com.docker.core.third.websocket.WebsocketPool;

import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

/**
 * @Author ldl
 * @Create 2021/01/14 014 10:10
 */
@Remark("拉取镜像长连接响应")
@ServerEndpoint("/websocket/image/pull")
public class ImagePullWebsocket extends BaseWebsocketController {

    private ImagesService service = Aop.get(ImagesService.class);

    @Override
    protected void onOpenBefore(Session session, String connectKey) {
    }

    @Override
    protected void onOpenAfter(Session session, String connectKey) {
    }

    @Override
    protected void onMessage(WebsocketPool socketPool, JSONObject msgJson) {
        service.onMessage(socketPool, msgJson);
    }

    @Override
    protected void onCloseBefore(Session session, String connectKey) {
    }

    @Override
    protected void onCloseAfter(Session session, String connectKey) {
    }

    @Override
    protected void onErrorBefore(Session session, String connectKey) {
    }

    @Override
    protected void onErrorAfter(Session session, String connectKey) {
    }

}
